<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <meta name="keywords" th:content="${article.seoKey}">
    <meta name="description" th:content="${article.seoDesc}">
    <title th:text="${article.title}"></title>
    <link rel="icon" th:href="${config.SITE_ICON}">
    <link rel="stylesheet" th:href="${static+'/css/bootstrap.min.css'}"/>
    <link rel="stylesheet" th:href="${static+'/iconfont/iconfont.css'}"/>
    <link rel="stylesheet" th:href="${static+'/css/github-markdown.min.css'}"/>
    <link rel="stylesheet" th:href="${static+'/css/blog.css'}"/>
    <script th:src="${static+'/js/jquery.min.js'}"></script>
    <script th:src="${static+'/js/bootstrap.min.js'}"></script>
    <script th:src="${static+'/js/blog.js'}"></script>
</head>
<body>
<header id="header">
    <div th:replace="theme/nbclass/fragments/navbar :: navbar"></div>
</header>
<div class="zb-container zb-content">
    <div class="zb-main">
        <div class="article-main">
            <h3 class="article-title" th:text="${article.title}"></h3>
            <span class="article-original" th:text="${article.origin==1 ? '原创' : '转载'}"></span>
            <div class="article-meta">发布于 <span th:text="${#dates.format(article.createTime,'yyyy-MM-dd')}"></span>
                &nbsp;|&nbsp; <span th:text="${article.category.name}"></span> &nbsp;|&nbsp; 浏览（<span
                        th:text="${article.lookNum}"></span>） &nbsp;|&nbsp; 评论（<span
                        th:text="${article.commentNum}"></span>）
            </div>
            <hr class="hr0"/>
            <div class="article-body markdown-body editor-preview-active-side" th:utext="${article.content}">
            </div>
            <div class="thumbs-content">
                <span class="thumbs-button fa fa-thumbs-up"> 点赞 <span id="loveCount"
                                                                      th:text="${article.supportNum}"></span></span>
                <span class="reward-button fa fa-money" th:if="${currentTheme.setting.zanShang=='1'}"> 打赏
							<p class="reward-content">
								<span class="reward-img"><img th:src="${currentTheme.setting.wxPayCode}"><br>微信赞赏</span>
								<span class="reward-img"><img
                                        th:src="${currentTheme.setting.aliPayCode}"><br>支付宝赞赏</span>
							</p>
							<span class="reward-bottom"></span>
							<span class="reward-bottom-top"></span>
						</span>
            </div>
        </div>
        <div class="comment comment-main" id="comment" th:if="${article.isComment}">
            <div class="comment-title">发表评论</div>
        </div>
    </div>
    <div th:replace="theme/nbclass/fragments/sidebar :: sidebar"></div>
    <div class="return_top"><a class=" fa fa-arrow-up"></a></div>
</div>
<script>
    $(function () {
        $(".thumbs-button").click(function () {
            Core.postAjax("/api/article/love", {articleId: [[${article.id}]]}, function (data) {
                if (data.status === 200) {
                    var $count = $("#loveCount");
                    $count.text(parseInt($count.text()) + 1);
                } else {
                    Core.msg(data.msg, 2);
                }
            })
        })
    });

    //这个不是写在首页，写在子页面（子页面才能返回，写在首页点击返回就是退出）
    //不用引入mui.js，都是h5方法
    document.addEventListener('plusready', function () {
        var webview = plus.webview.currentWebview();
        plus.key.addEventListener('backbutton', function () {
            webview.canBack(function (e) {
                if (e.canBack) {
                    webview.back();
                } else {
                    webview.close(); //hide,quit
                    //plus.runtime.quit();
                }
            })
        });
    });
</script>
<script th:if="${article.isComment}">
    Core.initComment({
        id: "#comment",
        sid: "[[${article.id}]]",
        emojiServer: "[[${static}]]" + "/emoji/"
    });
</script>
</body>

</html>